/*
 * =====================================================================================
 *
 *       Filename:  genNewData.cpp
 *
 *    Description:  Generates new data using simulated annealing
 *
 *        Version:  1.0
 *        Created:  10/07/12 14:53:49
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Moos Hueting (mh), mooshueting@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#include <stdlib.h>
#include <iostream>
#include <highgui.h>
#include "sa.h"
#include "features/char_features.h"

using namespace std;
using namespace cv;

int main(int argc, char* argv[]) {

    for (int i=0; i < 26; i++) {
        SA sa;
        sa.nsteps(1000, 10);

        Mat res;
        resize(sa.getSolution(), res, Size(0,0), 10, 10, INTER_NEAREST);

        namedWindow("Display", CV_WINDOW_AUTOSIZE);
        imshow("Display", res);
        waitKey(0);
    
        int rCorners = corners(res);
        float rConvexity = convexity(res);
        float rComplexity = complexity(res);
        int rDiffSegs0 = diffsegs(res, 0);
        int rDiffSegs1 = diffsegs(res, 1);
        int rEndpoints = endpoints(res);
        float rRatio = ratio(res);
        int rHoles = holes(res);
        float rAxisMean0 = axismean(res, 0);
        float rAxisMean1 = axismean(res, 1);

        // output features
        cout << "nc, " << rCorners << ", " << rConvexity << ", " << rComplexity << ", " << rDiffSegs0 << ", " << rDiffSegs1 << ", " << rEndpoints << ", " << rRatio << ", " << rHoles << ", " << rAxisMean0 << ", " << rAxisMean1 << endl;
    }
}
